<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    手机号码：<input type="text"> <button>按下</button>
    <script>
        var btn = document.querySelector('button')
        var times = 10
        btn.addEventListener('click', function() {
            btn.disabled = true
            var timer = setInterval(function() {
                    if (times === 0) {
                        btn.disabled = false
                        btn.innerHTML = '发送验证码'
                        times = 10
                        clearInterval(timer)
                    } else {
                        btn.innerHTML = `还剩下${times}秒`
                        times--
                    }
                },
                1000)
        })
    </script>
</body>

</html>